package practicedemo71;

import java.util.*;


public class Test {
    public static void main(String[] args) {

        ArrayList<Animal> list = new ArrayList<>();
        list.add(new Frog("小蛙", 3));
        list.add(new Dog("小狗", 6));
        list.add(new Sheep("小羊", 4));

        for (Animal animal : list) {
            //测试地址值
//            System.out.println(animal);
            System.out.println(animal.getName() + ", " + animal.getAge());
            animal.drink();
            animal.eat();
        }
    }
}
